package com.zfast.yugioh.junit;

import com.zfast.yugioh.antlr4.effect.EffectParser;
import com.zfast.yugioh.bo.CardBo;
import com.zfast.yugioh.constant.VerifyeEnum;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

/**
 * @author zgn
 * @Description: simJunit
 * @date 2022/1/13 0013
 */
public class simJunit {
    @Test
    public void egMax() {//e.g.
        //region 1.模拟数据
        System.out.println("--------------------Start--------------------");
        //endregion

        //region 2.数据处理
        System.out.println("--------------------Deal--------------------");
        //endregion

        //region 3.数据展示
        System.out.println("--------------------Done--------------------");
        //endregion
    }

    @Test
    public void 字串识别首字母_egMin() {//e.g.
        long start,end;
        start = System.currentTimeMillis();
        //region 被测时程序主体
        //Asd;asd;A;a
        String testStr="asd",parserStr="111服侍得";
        boolean matches = testStr.matches(VerifyeEnum.isFirstCharCase.getRegex());
        boolean matches1 = Pattern.compile(VerifyeEnum.isNumeric.getRegex()).matcher(parserStr).matches();
        System.out.println(matches);
        System.out.println(matches1);
        //endregion
        end = System.currentTimeMillis();
        System.out.println("耗费时间：" + (end-start));
    }

    @Test
    public void 对象List组合添加_egMin() {//e.g.
        List<String> group=new ArrayList<>();
        List<String> A=new ArrayList<>();
        List<String> B=new ArrayList<>();
        A.add("A_Str");
        B.add("B_Str");
        group.addAll(A);
        group.addAll(B);

        for (int i = 0; i <group.size(); i++) {
            String s =  group.get(i);
            System.out.println(s);
        }
    }

    @Test
    public void boolean拼接_egMin() {//e.g.
        boolean right=true,wrong=false;
        boolean resullt=right&wrong;
        System.out.println(resullt);
        resullt=right|wrong;
        System.out.println(resullt);
    }

    @Test
    public void class字串化_egMin() {//e.g. "同名cards3"
        System.out.println(EffectParser.WhereExprOrContext.class.getName());
        System.out.println(EffectParser.WhereExprAndContext.class.getName());
        System.out.println(EffectParser.Operator_EQContext.class.getName());
    }

    @Test
    public void 去除字串中的双引号_egMin() {//e.g.
        String test="\"同名cards3\"";
        System.out.println(test);
        System.out.println(test.replace("\"",""));
    }

    @Test
    public void 表达式limitStart和limitNum_egMin() {//e.g.
        String pre="字串";
        List<String> stringList=new ArrayList<>();
        for (int i = 0; i < 20; i++) {
            stringList.add(pre+i);
        }

        System.out.println("--------------------流筛选--------------------");
        List<String> collect = stringList.stream().skip(10).limit(5).collect(Collectors.toList());
        for (int i = 0; i < collect.size(); i++) {
            String s =  collect.get(i);
            System.out.println(s);
        }

        System.out.println("--------------------subList--------------------");
        List<String> strings = stringList.subList(10, 15);
        for (int i = 0; i < strings.size(); i++) {
            String s =  strings.get(i);
            System.out.println(s);
        }
    }

    @Test
    public void 对象类的toString_egMin() {//e.g.
        System.out.println(EffectParser.WhereExprOrContext.class.getName());
        System.out.println(EffectParser.WhereExprAndContext.class.toString());
        System.out.println(EffectParser.WhereExpr_PARENContext.class);
    }

    @Test
    public void List基础信息_egMin() {//e.g.
        List<CardBo> cards=new ArrayList<>();
        System.out.println(cards.isEmpty());
        System.out.println(cards.hashCode());
    }

    @Test
    public void _egMin() {//e.g.
        System.out.println();
    }

    @Test
    public void _egMin_time() {//e.g.
        long start,end;
        start = System.currentTimeMillis();
        //region 被测时程序主体
        //endregion
        end = System.currentTimeMillis();
        System.out.println("耗费时间：" + (end-start));
    }
}
